Skip to content

fix(keyboard): Japanese mapping - #101

Open
FoxRefire wants to merge 1 commit into
LizardByte:masterfrom
FoxRefire:fixJapaneseKeyboardMapping
Open

fix(keyboard): Japanese mapping#101
FoxRefire wants to merge 1 commit into
LizardByte:masterfrom
FoxRefire:fixJapaneseKeyboardMapping

Conversation

@FoxRefire

@FoxRefire FoxRefire commented Aug 22, 2026

Copy link
Copy Markdown

Description

Fix Japanese keyboard mapping
To be fixed, Need to merge all these PRs
moonlight-stream/moonlight-qt#1984
LizardByte/Sunshine#5542
#101

Issues Fixed or Closed

Fixes moonlight-stream/moonlight-qt#1962

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@CLAassistant

CLAassistant commented Aug 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
1 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ReenigneArcher ReenigneArcher changed the title Fix Japanese keyboard mapping fix(keyboard): Japanese mapping Aug 30, 2026

@ReenigneArcher ReenigneArcher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserve the actual Windows extended-key prefix

extended_scan_code() currently infers KEYEVENTF_EXTENDEDKEY from the low scan-code byte. Those bytes are shared by ordinary and extended keys, so this changes common QWERTY input:

  • Main Enter (0x1C) becomes keypad Enter (E0 1C).
  • / (0x35) becomes keypad Divide (E0 35).
  • Left Alt (0x38) becomes Right Alt (E0 38).
  • Several numpad keys can become navigation keys.

Please obtain the extended scan code with MAPVK_VK_TO_VSC_EX and preserve its actual E0/E1 prefix. The extended flag must not be inferred from the low byte alone.

This needs regression coverage for at least main Enter, /, \, left/right Alt, keypad Enter, keypad Divide, and the numpad/navigation pairs.

Update the XTest test hook for the new function signature

key_code_to_keysym() now requires the non_normalized argument, but tests/fixtures/linux_backend_test_hooks.cpp still calls it with one argument. Consequently, the tests do not compile when XTest is available and LIBVIRTUALHID_HAVE_XTEST=1.

Please update the test hook and add coverage for both normalized and non-normalized behavior.

Do not treat the common ISO key as Japanese Ro

The required Moonlight change groups SDL_SCANCODE_NONUSBACKSLASH with Japanese SDL_SCANCODE_INTERNATIONAL1 and marks both as non-normalized. In libvirtualhid, non-normalized key code 0xE2 maps to KEY_RO, while normalized 0xE2 correctly maps to KEY_102ND.

SDL_SCANCODE_NONUSBACKSLASH is the ordinary extra key on UK and other European ISO keyboards. It is commonly used for \| or <>; it is not the Japanese Ro key.

Please keep SDL_SCANCODE_NONUSBACKSLASH normalized and mark only the genuine JIS Ro scancode as non-normalized. Add regression coverage for US QWERTY, UK ISO, German/French ISO, and Japanese JIS layouts.

Correct the Korean IME mappings in the required Moonlight change

SDL_SCANCODE_LANG1 and SDL_SCANCODE_LANG2 are Korean Hangul/English-toggle and Hanja-conversion keys. They are currently being sent as Japanese Henkan and Muhenkan key codes, which libvirtualhid then maps to KEY_HENKAN and KEY_MUHENKAN.

Please give the Korean keys distinct mappings rather than reusing the Japanese conversion-key codes. The key code plus the current Boolean flag may be insufficient to distinguish all of these language-specific keys, so the protocol representation may need to carry an unambiguous physical-key identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Couldn't input backslash(\), pipe(|) and Muhenkan in Japanese keyboard

3 participants